package com.tm.media.login.controller;


import com.tm.media.login.service.IAdRoleService;
import com.tm.media.login.service.IAdUserService;
import com.tm.media.model.dtos.ResponseResult;
import com.tm.media.model.entity.AdRole;
import com.tm.media.model.entity.AdUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 管理员用户信息Controller
 * 
 * @author ruoyi
 * @date 2023-02-09
 */
@RestController
@CrossOrigin
@RequestMapping("system/user")
public class AdUserController {
    @Autowired
    private IAdUserService adUserService;
    @Autowired
    private IAdRoleService adRoleService ;
    @GetMapping("list")
    public PageUti1l list(PageUti1l pageUti1l){
       return adUserService.list(pageUti1l);
    }

    @PutMapping("updateUser")
    public ResponseResult updateUser(@RequestBody AdUser adUser){
        return adUserService.addUser(adUser);
    }
    @PostMapping("addUser")
    public ResponseResult addUser(@RequestBody AdUser adUser){
        return adUserService.addUser(adUser);
    }
    @DeleteMapping("deleteUserById")
    public ResponseResult deleteUserById(Integer id){
        return adUserService.deleteUserById(id);
    }
    @GetMapping("listRole")
    public List<AdRole>listRole(){

        return  adRoleService.selectRoleList();
    }
}
